home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 1 / csmp-v1-175.txt < prev    next >
Encoding:
Text File  |  1992-12-31  |  44.7 KB  |  1,096 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Sun, 04 Oct 92       Volume 1 : Issue 175
  2.  
  3. Today's Topics:
  4.  
  5.     Changing Command-Key for a menu item
  6.     Using GetNextEvent or WaitNextEvent...
  7.     Gestalt glue is redundant!
  8.  
  9.  
  10.  
  11. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  12.  
  13. The digest is a collection of article threads from the internet newsgroup
  14. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  15. regularly and want an archive of the discussions.  If you don't know what a
  16. newsgroup is, you probably don't have access to it.  Ask your systems
  17. administrator(s) for details.  (This means you can't post questions to the
  18. digest.)
  19.  
  20. Each issue of the digest contains one or more sets of articles (called
  21. threads), with each set corresponding to a 'discussion' of a particular
  22. subject.  The articles are not edited; all articles included in this digest
  23. are in their original posted form (as received by our news server at
  24. cs.uoregon.edu).  Article threads are not added to the digest until the last
  25. article added to the thread is at least one month old (this is to ensure that
  26. the thread is dead before adding it to the digest).  Article threads that
  27. consist of only one message are generally not included in the digest.
  28.  
  29. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  30. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  31. file /pub/mac/csmp-digest/README before downloading any files.  The most
  32. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  33. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  34. archive has a mail server; send a message with the text '$MACarch help' (no
  35. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  36.  
  37. The digest is also available via email.  Just send a note saying that you
  38. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  39. automatically receive each new issue as it is created.  Sorry, back issues
  40. are not available through the mailing list.
  41.  
  42. Send administrative mail to mkelly@cs.uoregon.edu.
  43.  
  44.  
  45. -------------------------------------------------------
  46.  
  47. From: erh0362@tesla.njit.edu (Elliotte Rusty Harold)
  48. Subject: Changing Command-Key for a menu item
  49. Date: 15 Jul 92 12:31:17 GMT
  50. Organization: New Jersey Institute of Technology
  51.  
  52.  
  53.     Is there a means of changing not only the text of a menu item, but also 
  54. the Command-Key?  I'd like my application menu to toggle between Pause, 
  55. Command-Comma and Run, Command-R as appropriate.  Is there a toolbox call I'm 
  56. missing to do this?  Is there a hack to do this short of writing my own MDEF?  
  57. Is this a horrible violation of the user interface guidelines that will bring 
  58. down the wrath of the UI thought-police upon me?
  59.  
  60. Elliotte Rusty Harold        Department of Applied Mathematics
  61. elharo@m.njit.edu        New Jersey Institute of Technology
  62. erh0362@tesla.njit.edu        Newark, NJ 07103
  63.  
  64. +++++++++++++++++++++++++++
  65.  
  66. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  67. Organization: Kalamazoo College
  68. Date: Wed, 15 Jul 1992 13:19:11 GMT
  69.  
  70. erh0362@tesla.njit.edu (Elliotte Rusty Harold) writes:
  71. >
  72. >    Is there a means of changing not only the text of a menu item, but also 
  73. >the Command-Key?  I'd like my application menu to toggle between Pause, 
  74. >Command-Comma and Run, Command-R as appropriate.
  75.  
  76. I suggest two menu items, one of which is always dimmed.
  77.  
  78. It's incredible to me how an interface that prides itself on showing
  79. everything to the user can _still_, in _1992_, have toggling menu items
  80. that toggle the _name_.  What's wrong with a checkmark by a "Visible
  81. Rulers" item?  Why does the item have to bounce between "Hide Rulers"
  82. and "Show Rulers"?
  83.  
  84. The problem's especially distracting when combined with items that may
  85. or may not be nouns.  When Ofoto says "Autostraighten On", does it mean:
  86.     (a) Autostraightening is on;
  87.     (b) If autostraightening were on, there'd be a checkmark here;
  88.     (c) Select this item to turn autostraightening on?
  89. Surely someone's noticed that people will select the item two or three
  90. times in a row, watching it change, before they figure out what it does!
  91.  
  92. If it _does_ something, make it a verb:  Edit Macros.
  93. If it _shows_ the state of something, make it a noun:  Fractional Widths.
  94. If it _toggles_ between two states, make it a noun with a checkmark:
  95.     >check< Visible Rulers.
  96. - -- 
  97.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  98.  Only one Amendment explains the reason for its existence; unfortunately,
  99.  Congress is under no compulsion to follow reason.  "A well-regulated
  100.  militia being necessary to the security of a free state..."
  101.  
  102. +++++++++++++++++++++++++++
  103.  
  104. From: max@eskimo.celestial.com (Max Pinton)
  105. Organization: -> ESKIMO NORTH (206) For-Ever <-
  106. Date: Tue, 21 Jul 1992 07:35:41 GMT
  107.  
  108. k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  109. : erh0362@tesla.njit.edu (Elliotte Rusty Harold) writes:
  110. : It's incredible to me how an interface that prides itself on showing
  111. : everything to the user can _still_, in _1992_, have toggling menu items
  112. : that toggle the _name_.  What's wrong with a checkmark by a "Visible
  113. : Rulers" item?  Why does the item have to bounce between "Hide Rulers"
  114. : and "Show Rulers"?
  115. : If it _does_ something, make it a verb:  Edit Macros.
  116. : If it _shows_ the state of something, make it a noun:  Fractional Widths.
  117. : If it _toggles_ between two states, make it a noun with a checkmark:
  118. :     >check< Visible Rulers.
  119.  
  120.     Tog talks about this in _Tog on Interface_ ... Another problem with
  121. rotating menu items is that the menu item indicates the opposite of the
  122. current state; "Hide Rulers" is in the menu when the rulers are *not*
  123. hidden.
  124.  
  125.     It's all pretty tacky to me.
  126.  
  127.  
  128. ---------------------------
  129.  
  130. From: dave@gergo.tamu.edu (Dave Martin)
  131. Subject: Using GetNextEvent or WaitNextEvent...
  132. Date: 16 Jul 92 22:00:00 GMT
  133. Organization: Geochemical & Environmental Research Group, Texas A&M University
  134.  
  135. What's the best way to implement a main loop which can get it's events
  136. either from WaitNextEvent or GetNextEvent (if WNE isn't available on
  137. that machine)? I've added the TrapAvailable stuff from IM VI for seeing
  138. if the WNE trap is there, but am not sure of the best way to set up
  139. the event checking (in THINK Pascal). My app needs to run on any Mac
  140. and don't want to only use WNE in case it might cause it to not work
  141. on particular Macs, but also don't want to just go with GNE. 
  142. I was thinking along the lines of a boolean (hasWNE) and doing an:
  143.     IF (hasWNE AND WaitNextEvent(...)) OR 
  144.               (NOT(hasWNE) AND GetNextEvent(...)) THEN... (Main Loop)
  145.  
  146. [i.e. - if the WNE trap is there, and it returns an event; or, if WNE is
  147.  not available and GNE returns an event...]
  148.  
  149. Is this a possible solution, or would this miss the point of WNE? Also,
  150. would this still crash on a Mac which doesn't have the WNE trap? 
  151.  
  152.  -                                                                     -
  153.  - Dave Martin - Geochemical & Environmental Research Group, Texas A&M - 
  154.  - DAVE@GERGA[GERGO,GERGI].TAMU.EDU - BROOKS@TAMVXOCN.BITNET - AOL:DBM -
  155.  -                                                                     -
  156.  
  157. +++++++++++++++++++++++++++
  158.  
  159. From: hammett@sbsu1.aukuni.ac.nz (Tim Hammett)
  160. Date: Fri, 17 Jul 1992 00:53:54 GMT
  161. Organization: University of Auckland, New Zealand.
  162.  
  163. dave@gergo.tamu.edu (Dave Martin) writes:
  164. >What's the best way to implement a main loop which can get it's events
  165. >either from WaitNextEvent or GetNextEvent (if WNE isn't available on
  166. >that machine)? I've added the TrapAvailable stuff from IM VI for seeing
  167.  
  168. Here's what I did. (I say "did" because I'm not sure it's worth supporting
  169. machines that don't have WaitNextEvent() any more. Even if you can get around
  170. not having WaitNextEvent(), there are so many hairy problems involved
  171. in supporting & testing on systems older than, say 6.02, that it probably
  172. isn't worth the effort).
  173.  
  174. My approach was to have a dummy routine called "WNEEmulator" that takes the
  175. same arguments as WaitNextEvent(). In my main event loop, I call the real
  176. WaitNextEvent() if the trap exists, or the emulator if it doesn't.
  177.  
  178. Warning: Although this code works for me, it hasn't exactly been well
  179. tested on a wide range of machines & system versions. Also note that it
  180. was written before AppleEvents came along, so there might be additional
  181. considerations relating to those (though I can't think of any at the moment).
  182.  
  183. /* Globals */
  184.  
  185. Boolean gHasWNE;            /* WaitNextEvent trap available */
  186. Boolean gQuit;              /* Has the user chosen Quit? */
  187. short gSysVersion;          /* Current system version (for avoiding System 4.x
  188.                              * WNE bug on Mac II [TN177]) */
  189. long gWNESleep = 50;        /* Time to sleep for in WaitNextEvent */
  190. EventRecord gEvent;         /* Last event we got */
  191. Boolean gInBackground;      /* Are we the foreground app? */
  192. RgnHandle gCursorRgn;       /* Cursor tracking region for WaitNextEvent */
  193.  
  194.  
  195. #ifdef applec /* Bung it in its own segment if this is MPW C */
  196.     #pragma segment WNEEmulator
  197. #endif
  198.  
  199. /* WaitNextEvent simulator - called if the WaitNextEvent() trap is not
  200.  * available.
  201.  */
  202.  
  203. Boolean WNEEmulator(short theMask,EventRecord *theEvent,unsigned long sleep,
  204.     RgnHandle mouseRgn)
  205. {
  206.     static unsigned long lastMouseCheck; /* Only check mouse posn once per tick.
  207.                                           * Needs to be static since routine
  208.                                           * could be called more than once per
  209.                                           * tick */
  210.     unsigned long timeOut;
  211.     Boolean gotEvent;
  212.     
  213.     
  214.     timeOut = TickCount() + sleep;
  215.     
  216.     /* Mouse-moved events shouldn't be generated if mouseRgn is
  217.      * the empty region */
  218.     
  219.     if( EmptyRgn(mouseRgn) )
  220.         mouseRgn = nil;
  221.     
  222.     do {
  223.         
  224.         SystemTask();
  225.         
  226.         gotEvent = GetNextEvent(theMask,theEvent);
  227.  
  228.         if( ! gotEvent && mouseRgn != nil && lastMouseCheck < TickCount() ) {
  229.         
  230.             lastMouseCheck = TickCount();
  231.             
  232.             if( ! PtInRgn(theEvent->where,mouseRgn) ) {
  233.                 theEvent->what = osEvt;
  234.                 theEvent->message = 0xfa000000;
  235.                 gotEvent = true;
  236.             }
  237.  
  238.         }
  239.         
  240.     } while( ! gotEvent && (TickCount() < timeOut) );
  241.     
  242.     return( gotEvent );
  243. }
  244.  
  245. #ifdef applec
  246.     #pragma segment Main
  247. #endif
  248.  
  249.  
  250. void EventLoop(void)
  251. {
  252.     Boolean gotEvent;
  253.  
  254.     do {
  255.         
  256.         if( gHasWNE ) {
  257.         
  258.             if( gSysVersion < 0x04ff && gInBackground && gWNESleep > 50 )
  259.                 gWNESleep = 50;     /* System 4.x bug on Mac II as per TN177 */
  260.         
  261.             gotEvent = WaitNextEvent(everyEvent,&gEvent,gWNESleep,gCursorRgn);
  262.         
  263.         }
  264.         else
  265.             gotEvent = WNEEmulator(everyEvent,&gEvent,gWNESleep,gCursorRgn);
  266.         
  267.         
  268.         /* Ignore gotEvent for the moment, as we want to pass nullEvents
  269.          * through as well */
  270.         
  271.         DoEvent( &gEvent );
  272.         
  273.     } while( ! gQuit );
  274. }
  275.  
  276.  
  277. - --
  278. Tim Hammett, Botany Dept, Auckland University, New Zealand.
  279. t.hammett@aukuni.ac.nz   Phone: +64-9-373-7599 x8365    FAX: +64-9-373-7416
  280.  
  281. +++++++++++++++++++++++++++
  282.  
  283. From: dave@gergo.tamu.edu (Dave Martin)
  284. Date: 17 Jul 92 13:21:00 GMT
  285. Organization: Geochemical & Environmental Research Group, Texas A&M University
  286.  
  287. In article <hammett.711334434@sbsu1.aukuni.ac.nz>, hammett@sbsu1.aukuni.ac.nz (Tim Hammett) writes...
  288. >dave@gergo.tamu.edu (Dave Martin) writes:
  289. >>What's the best way to implement a main loop which can get it's events
  290. >>either from WaitNextEvent or GetNextEvent (if WNE isn't available on
  291. >>that machine)? I've added the TrapAvailable stuff from IM VI for seeing
  292. >Here's what I did. (I say "did" because I'm not sure it's worth supporting
  293. >machines that don't have WaitNextEvent() any more. Even if you can get around
  294. >not having WaitNextEvent(), there are so many hairy problems involved
  295. >in supporting & testing on systems older than, say 6.02, that it probably
  296. >isn't worth the effort).
  297.  
  298. OK, maybe I'm assuming incorrectly, but what are the machine/system version
  299. boundaries for whether WNE is available? I couldn't find any reference to
  300. WNE in SpInside Mac 2.02 and the first reference I've seen is in IM VI,
  301. which implies that it's a System 7 thing. Was it documented in a TN?
  302. Primarily, I need my app to run in any environment which America Online
  303. can run in, which I believe is Mac Plus and higher, 6.x and higher. Is
  304. WNE present in all these cases? 
  305.  
  306.  -                                                                     -
  307.  - Dave Martin - Geochemical & Environmental Research Group, Texas A&M - 
  308.  - DAVE@GERGA[GERGO,GERGI].TAMU.EDU - BROOKS@TAMVXOCN.BITNET - AOL:DBM -
  309.  -                                                                     -
  310.  
  311. +++++++++++++++++++++++++++
  312.  
  313. From: jcav@quads.uchicago.edu (JohnC)
  314. Organization: The Royal Society for Putting Things on Top of Other Things
  315. Date: Fri, 17 Jul 1992 15:18:18 GMT
  316.  
  317. In article <17JUL199207210308@gergo.tamu.edu> dave@gergo.tamu.edu (Dave Martin) writes:
  318. >OK, maybe I'm assuming incorrectly, but what are the machine/system version
  319. >boundaries for whether WNE is available?
  320.  
  321. The best way to find out if _WaitNextEvent (or any trap) is available is to
  322. use something like the TrapAvailable code in IM-6.  (Of course the best best
  323. way is to use Gestalt, but some things don't have selectors...).
  324.  
  325. _WaitNextEvent first appeared with the original Multifinder, which ran under
  326. System version 4.2.  In this original version, _WaitNextEvent was _not_
  327. present if Multifinder was turned off.  I believe that this OS version had a
  328. collective name of System Tools 5.  When System 6 came out, things were
  329. changed so that _WaitNextEvent was always present, whether or not Multifinder
  330. was turned on.  If you don't want to bother with TrapAvailable (and you
  331. really should), you can check for System 6 or newer.
  332.  
  333. - -- 
  334. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  335. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  336. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  337. B0 f++ c+ g++ k s++ e+ h- pv    |         Chicago, IL  60637
  338.  
  339. +++++++++++++++++++++++++++
  340.  
  341. From: dave@gergo.tamu.edu (Dave Martin)
  342. Organization: Geochemical & Environmental Research Group, Texas A&M University
  343. Date: Mon, 20 Jul 1992 19:01:00 GMT
  344.  
  345. In article <1992Jul17.151818.11771@midway.uchicago.edu>, jcav@midway.uchicago.edu writes...
  346. >The best way to find out if _WaitNextEvent (or any trap) is available is to
  347. >use something like the TrapAvailable code in IM-6.  (Of course the best best
  348. >way is to use Gestalt, but some things don't have selectors...).
  349.  
  350. That's exactly what I planned to do, since they provided the TrapAvailable
  351. code right there.
  352.  
  353. >_WaitNextEvent first appeared with the original Multifinder, which ran under
  354. >System version 4.2.  In this original version, _WaitNextEvent was _not_
  355. >present if Multifinder was turned off.  I believe that this OS version had a
  356. >collective name of System Tools 5.  When System 6 came out, things were
  357. >changed so that _WaitNextEvent was always present, whether or not Multifinder
  358. >was turned on.  If you don't want to bother with TrapAvailable (and you
  359. >really should), you can check for System 6 or newer.
  360.  
  361. I guess I don't really need to bother with GNE, then. Since my app is meant
  362. for AOL, and it (I believe) requires System 6.x or higher, then I'm probably
  363. safe. What I did end up doing (thanks to the responses I got [well, except
  364. for those who sent C code when I said "in THINK Pascal" ;] both here and in
  365. email) was to use the TrapAvailable procedure to set a boolean, hasWNE. In
  366. the main loop, I test hasWNE, if true, then I see if WNE has an event; if not,
  367. I use GNE for the event. In both cases I set another boolean if there is an
  368. event. I then do my CASE on the event record if hasEvent is true. It works,
  369. even if it might not be the most efficient. I may go ahead and rewrite it to
  370. only use WNE, if WNE is really in Sys6 whether MF is on or off. Thanks! 
  371.  
  372.  -                                                                     -
  373.  - Dave Martin - Geochemical & Environmental Research Group, Texas A&M - 
  374.  - DAVE@GERGA[GERGO,GERGI].TAMU.EDU - BROOKS@TAMVXOCN.BITNET - AOL:DBM -
  375.  -                                                                     -
  376.  
  377. +++++++++++++++++++++++++++
  378.  
  379. From: jcav@quads.uchicago.edu (JohnC)
  380. Organization: The Royal Society for Putting Things on Top of Other Things
  381. Date: Mon, 20 Jul 1992 19:50:50 GMT
  382.  
  383. In article <20JUL199213014121@gergo.tamu.edu> dave@gergo.tamu.edu (Dave Martin) writes:
  384. >I may go ahead and rewrite it to only use WNE, if WNE is really in Sys6
  385. >whether MF is on or off.
  386.  
  387. _WaitNextEvent really and truly is always available under System 6 or newer.
  388. Honestly.  Would I lie to you?  :-)
  389.  
  390. - -- 
  391. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  392. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  393. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  394. B0 f++ c+ g++ k s++ e+ h- pv    |         Chicago, IL  60637
  395.  
  396. +++++++++++++++++++++++++++
  397.  
  398. From: hpoppe@ncar.ucar.edu (Herb Poppe)
  399. Date: 21 Jul 92 20:21:41 GMT
  400. Organization: National Center for Atmospheric Research
  401.  
  402. In article <16JUL199216005351@gergo.tamu.edu> dave@gergo.tamu.edu (Dave 
  403. Martin) writes:
  404.  
  405. > What's the best way to implement a main loop which can get it's events
  406. > either from WaitNextEvent or GetNextEvent (if WNE isn't available on
  407. > that machine)?
  408.  
  409. > I was thinking along the lines of a boolean (hasWNE) and doing an:
  410.  
  411. >     IF (hasWNE AND WaitNextEvent(...)) OR 
  412. >               (NOT(hasWNE) AND GetNextEvent(...)) THEN... (Main Loop)
  413.  
  414. Note that both WaitNextEvent and GetNextEvent could be called depending on 
  415. how the compiler you use compiles AND and OR. The Pascal standard does not 
  416. require short-circuit evaluation of AND and OR. THINK Pascal (at least, 
  417. don't know about MPW) provides non-standard forms of AND and OR (I forget 
  418. the syntax) that always result in short-circuit evaluation.
  419.  
  420. Herb Poppe                 National Center for Atmospheric Research (NCAR)
  421. hpoppe@ncar.ucar.edu       1850 Table Mesa Dr.
  422. (303) 497-1296             Boulder, CO  80303
  423.  
  424. ---------------------------
  425.  
  426. From: scott@mcl.ucsb.edu (Scott Bronson)
  427. Subject: Gestalt glue is redundant!
  428. Date: 8 Jul 92 10:59:11 GMT
  429.  
  430. I have some irks with THINK and MPW's using glue that emulates gestalt.
  431. Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  432. check to see if the _GestaltDispatch trap is defined before calling it.
  433. So, because my code checks like the book says, the glue never gets
  434. called, right?
  435.  
  436. Also, how can this glue be small and unobtrusive and still emulate
  437. Gestalt?  Obviously, the glue can't emulate all selectors (as many
  438. haven't even been thought of yet) so which ones does the glue take
  439. care of?  How can we be certain that this glue won't break on a future
  440. Macintosh system (or emulator)?
  441.  
  442. Is there any way for me to prevent this Gestalt glue from being
  443. included in my application?  Also, is the source to this glue lying
  444. around anywhere (so I can see what it takes care of and how, so I
  445. can quell my fears about using it)?
  446.  
  447. Thanks in advance!
  448.  
  449.     - Scott
  450.  
  451. +++++++++++++++++++++++++++
  452.  
  453. From: neeri@iis.ethz.ch (Matthias Neeracher)
  454. Organization: Integrated Systems Laboratory, ETH, Zurich
  455. Date: Wed, 8 Jul 1992 13:27:01 GMT
  456.  
  457. In article <scott.710593151@mcl> scott@mcl.ucsb.edu (Scott Bronson) writes:
  458. >I have some irks with THINK and MPW's using glue that emulates gestalt.
  459. >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  460. >check to see if the _GestaltDispatch trap is defined before calling it.
  461. >So, because my code checks like the book says, the glue never gets
  462. >called, right?
  463.  
  464. Yes. Don't check, then :-)
  465.  
  466. >Also, how can this glue be small and unobtrusive and still emulate
  467. >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  468. >haven't even been thought of yet) so which ones does the glue take
  469. >care of?  How can we be certain that this glue won't break on a future
  470. >Macintosh system (or emulator)?
  471.  
  472. The Gestalt glue emulates all selectors that provide information that could
  473. have been obtained by calling SysEnvirons (Someone kick me if I'm wrong). The
  474. glue won't break on a future Mac system, as future Mac systems will have the
  475. _Gestalt trap.
  476.  
  477. >Is there any way for me to prevent this Gestalt glue from being
  478. >included in my application?
  479.  
  480. #define SystemSevenOrLater in MPW.
  481.  
  482. >Also, is the source to this glue lying
  483. >around anywhere (so I can see what it takes care of and how, so I
  484. >can quell my fears about using it)?
  485.  
  486. Again in MPW: DumpObj -m GESTALT {Libraries}Runtime.o
  487.  
  488. Void where prohibited by law.
  489.  
  490. Matthias
  491.  
  492. - -----
  493. Matthias Neeracher                                   neeri@iis.ethz.ch
  494.  "You must have picked up that copy of Scarlett instead of Inside Mac
  495.   when you tried to find the right call..." -- Keith Rollin
  496.  
  497. +++++++++++++++++++++++++++
  498.  
  499. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  500. Organization: Kalamazoo College
  501. Date: Wed, 8 Jul 1992 13:08:04 GMT
  502.  
  503. scott@mcl.ucsb.edu (Scott Bronson) writes:
  504. >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  505. >check to see if the _GestaltDispatch trap is defined before calling it.
  506. >So, because my code checks like the book says, the glue never gets
  507. >called, right?
  508.  
  509. Right.  Don't bother checking, let the compiler do the work for you.
  510.  
  511. >Also, how can this glue be small and unobtrusive and still emulate
  512. >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  513. >haven't even been thought of yet) so which ones does the glue take
  514. >care of?  How can we be certain that this glue won't break on a future
  515. >Macintosh system (or emulator)?
  516.  
  517. Gestalt is set up so that older things return 0 and newer things return 1.
  518. I presume the glue just returns 0 in cases where it "doesn't know."
  519.  
  520. >Is there any way for me to prevent this Gestalt glue from being
  521. >included in my application?
  522.  
  523. Apart from not calling Gestalt...no, I don't think so.
  524.  
  525. >Also, is the source to this glue lying
  526. >around anywhere (so I can see what it takes care of and how, so I
  527. >can quell my fears about using it)?
  528.  
  529. It's with the source to the rest of MacTraps--us lowly users can't get
  530. at it.
  531. - -- 
  532.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  533.  Life is a merry merry-go-round;  try to learn the secret I have found.
  534.  Free and easy, easy and free.  That's the way it's gotta be.
  535.  
  536. +++++++++++++++++++++++++++
  537.  
  538. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  539. Organization: Royal Institute of Technology, Stockholm, Sweden
  540. Date: Wed, 8 Jul 1992 13:53:54 GMT
  541.  
  542. @mcl.ucsb.edu (Scott Bronson) writes:
  543.  
  544.    I have some irks with THINK and MPW's using glue that emulates gestalt.
  545.    Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  546.    check to see if the _GestaltDispatch trap is defined before calling it.
  547.    So, because my code checks like the book says, the glue never gets
  548.    called, right?
  549.  
  550. If you compile your headers using #define SystemSevenOrLater
  551. (need to re-compile MacHeaders in Think) it will call Gestalt
  552. directly instead of calling the glue.
  553.  
  554. - -- 
  555.          Jon W{tte, Svartmangatan 18, S-111 29 Stockholm, Sweden
  556.  
  557. ### You have the Easy Access virus. This virus may cause strange sounds
  558. ### and weird keyboard behaviour when you press the shift key repeatedly.
  559.  
  560. +++++++++++++++++++++++++++
  561.  
  562. From: creiman@Apple.COM (Charle Reiman)
  563. Date: 8 Jul 92 16:32:33 GMT
  564. Organization: Apple Computer Inc., Cupertino, CA
  565.  
  566. scott@mcl.ucsb.edu (Scott Bronson) writes:
  567.  
  568. >I have some irks with THINK and MPW's using glue that emulates gestalt.
  569. >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  570. >check to see if the _GestaltDispatch trap is defined before calling it.
  571. >So, because my code checks like the book says, the glue never gets
  572. >called, right?
  573.  
  574. Uh, no. If you call Gestalt(...) in C or pascal, then it goes thru the
  575. glue.  The linker doesn't give a hooey what code comes before or after
  576. a function call. If you invoke the _Gestalt trap in assembly, then
  577. there is no glue and you are on your own.
  578.  
  579. >Also, how can this glue be small and unobtrusive and still emulate
  580. >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  581. >haven't even been thought of yet) so which ones does the glue take
  582. >care of?  How can we be certain that this glue won't break on a future
  583. >Macintosh system (or emulator)?
  584.  
  585. It's Apple's job to make sure it works well. We're taking care of it.
  586. Relax, leave the driving to us.
  587.  
  588. >Is there any way for me to prevent this Gestalt glue from being
  589. >included in my application?  Also, is the source to this glue lying
  590. >around anywhere (so I can see what it takes care of and how, so I
  591. >can quell my fears about using it)?
  592.  
  593. If you hate our glue, use assembly and write your own. _Gestalt is the
  594. trap name, nach.  Writing assembly glue is beyond the scope of this
  595. posting.
  596.  
  597. As for source:
  598.  
  599. (in MPW)
  600.  
  601. DumpObj -m GESTALT "{Libraries}"Interface.o
  602.  
  603.  
  604.  
  605.  
  606. Module:              Flags=$08=(Extern Code)  Module="GESTALT"(594) Segment="Main"(306)
  607.  
  608. Content:             Flags $08
  609. Contents offset $0000 size $020E
  610. 00000000: 4E56 0000      'NV..'            LINK       A6,#$0000
  611. 00000004: 203C 0000 A89F ' <....'          MOVE.L     #$0000A89F,D0
  612. 0000000A: A746           '.F'              _GetTrapAddress  ,Sys,Immed          ; A746
  613. 0000000C: 2F08           '/.'              MOVE.L     A0,-(A7)
  614.  
  615. <...etc...>
  616.  
  617. If you're running Think C, you can probably get to the Gestalt glue by
  618. ResEditing an application that calls Gestalt and disassembling it with
  619. the code viewer. Simply search for invocations of the _Gestalt (A1AD)
  620. trap.
  621.  
  622. Man, some people are just never satisfied. :-) For me, nothing beats
  623. hot, fresh Gestalt, covered with lots of sticky glue.
  624.  
  625. - -- 
  626. Charlie Reiman
  627. creiman@apple.com
  628.  
  629. +++++++++++++++++++++++++++
  630.  
  631. From: potts@itl.itd.umich.edu (Paul Potts)
  632. Date: 10 Jul 92 19:55:20 GMT
  633. Organization: Instructional Technology Laboratory, University of Michigan
  634.  
  635. In article <scott.710593151@mcl> scott@mcl.ucsb.edu (Scott Bronson) writes:
  636. >I have some irks with THINK and MPW's using glue that emulates gestalt.
  637. >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  638. >check to see if the _GestaltDispatch trap is defined before calling it.
  639. >So, because my code checks like the book says, the glue never gets
  640. >called, right?
  641. >
  642. >Also, how can this glue be small and unobtrusive and still emulate
  643. >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  644. >haven't even been thought of yet) so which ones does the glue take
  645. >care of?  
  646.  
  647. Find out!  Call them. If the glue can't determine the information needed
  648. to answer a Gestalt question, it will return one of the Gestalt error codes
  649. indicating this (one of the -500 codes).
  650.  
  651. >How can we be certain that this glue won't break on a future
  652. >Macintosh system (or emulator)?
  653. >
  654.  
  655. One must have faith, for without faith, one is nothing.
  656.  
  657. Seriously... if the compiler writers can't be trusted to write compatible
  658. code, then who can? Presumably, Gestalt will always exist on a future system,
  659. so the glue will simply call it. It shouldn't be necessary to figure out
  660. an alternate method to determine the information wanted.
  661.  
  662. - -- 
  663. ..though I respect that a lot, I'd be fired if that were my job, after 
  664. killing Jason off and countless screaming argonauts... (They Might Be Giants)
  665. Paul R. Potts, Software Designer --- potts@itl.itd.umich.edu <--- me!
  666.  
  667. +++++++++++++++++++++++++++
  668.  
  669. From: REEKES@applelink.apple.com (Jim Reekes)
  670. Date: 11 Jul 92 01:33:39 GMT
  671. Organization: Apple Computer, Inc.
  672.  
  673. In article <69761@apple.Apple.COM>, creiman@Apple.COM (Charle Reiman) writes:
  674. > scott@mcl.ucsb.edu (Scott Bronson) writes:
  675. > >I have some irks with THINK and MPW's using glue that emulates gestalt.
  676. > >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  677. > >check to see if the _GestaltDispatch trap is defined before calling it.
  678. > >So, because my code checks like the book says, the glue never gets
  679. > >called, right?
  680. > Uh, no. If you call Gestalt(...) in C or pascal, then it goes thru the
  681. > glue.  The linker doesn't give a hooey what code comes before or after
  682. > a function call. If you invoke the _Gestalt trap in assembly, then
  683. > there is no glue and you are on your own.
  684. > >Also, how can this glue be small and unobtrusive and still emulate
  685. > >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  686. > >haven't even been thought of yet) so which ones does the glue take
  687. > >care of?  How can we be certain that this glue won't break on a future
  688. > >Macintosh system (or emulator)?
  689. > It's Apple's job to make sure it works well. We're taking care of it.
  690. > Relax, leave the driving to us.
  691. > >Is there any way for me to prevent this Gestalt glue from being
  692. > >included in my application?  Also, is the source to this glue lying
  693. > >around anywhere (so I can see what it takes care of and how, so I
  694. > >can quell my fears about using it)?
  695. > If you hate our glue, use assembly and write your own. _Gestalt is the
  696. > trap name, nach.  Writing assembly glue is beyond the scope of this
  697. > posting.
  698.  
  699. No no no.  If you don't want the Glue for Gestalt, then you don't have to
  700. use it.  Take a look at the C interface for the trap. If you set the
  701. - -d SystemSevenOrLater flag you will get _no_ glue at all.
  702.  
  703. But! the glue for Gestalt is pretty small, about 500 bytes the last time
  704. I checked.  If you do set this flag, then you will have to check for
  705. the trap being implemented, and always check for errors returned by Gestalt.
  706.  
  707.  
  708. #if SystemSevenOrLater
  709. #pragma parameter __D0 Gestalt(__D0,__A1)
  710. pascal OSErr Gestalt(OSType selector,long *response)
  711.  = {0xA1AD,0x2288}; 
  712. #else
  713. pascal OSErr Gestalt(OSType selector,long *response);
  714. #endif
  715.  
  716. - -----------------------------------------------------------------------
  717. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  718.                              |          Sound Manager Expert
  719. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  720. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  721. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  722.  
  723. +++++++++++++++++++++++++++
  724.  
  725. From: REEKES@applelink.apple.com (Jim Reekes)
  726. Date: 11 Jul 92 01:33:25 GMT
  727. Organization: Apple Computer, Inc.
  728.  
  729. In article <69761@apple.Apple.COM>, creiman@Apple.COM (Charle Reiman) writes:
  730. > scott@mcl.ucsb.edu (Scott Bronson) writes:
  731. > >I have some irks with THINK and MPW's using glue that emulates gestalt.
  732. > >Isn't glue that emulates gestalt redundant? _Programming System 7_ says to
  733. > >check to see if the _GestaltDispatch trap is defined before calling it.
  734. > >So, because my code checks like the book says, the glue never gets
  735. > >called, right?
  736. > Uh, no. If you call Gestalt(...) in C or pascal, then it goes thru the
  737. > glue.  The linker doesn't give a hooey what code comes before or after
  738. > a function call. If you invoke the _Gestalt trap in assembly, then
  739. > there is no glue and you are on your own.
  740. > >Also, how can this glue be small and unobtrusive and still emulate
  741. > >Gestalt?  Obviously, the glue can't emulate all selectors (as many
  742. > >haven't even been thought of yet) so which ones does the glue take
  743. > >care of?  How can we be certain that this glue won't break on a future
  744. > >Macintosh system (or emulator)?
  745. > It's Apple's job to make sure it works well. We're taking care of it.
  746. > Relax, leave the driving to us.
  747. > >Is there any way for me to prevent this Gestalt glue from being
  748. > >included in my application?  Also, is the source to this glue lying
  749. > >around anywhere (so I can see what it takes care of and how, so I
  750. > >can quell my fears about using it)?
  751. > If you hate our glue, use assembly and write your own. _Gestalt is the
  752. > trap name, nach.  Writing assembly glue is beyond the scope of this
  753. > posting.
  754.  
  755. No no no.  If you don't want the Glue for Gestalt, then you don't have to
  756. use it.  Take a look at the C interface for the trap. If you set the
  757. - -d SystemSevenOrLater flag you will get _no_ glue at all.
  758.  
  759. But! the glue for Gestalt is pretty small, about 500 bytes the last time
  760. I checked.  If you do set this flag, then you will have to check for
  761. the trap being implemented, and always check for errors returned by Gestalt.
  762.  
  763.  
  764. #if SystemSevenOrLater
  765. #pragma parameter __D0 Gestalt(__D0,__A1)
  766. pascal OSErr Gestalt(OSType selector,long *response)
  767.  = {0xA1AD,0x2288}; 
  768. #else
  769. pascal OSErr Gestalt(OSType selector,long *response);
  770. #endif
  771.  
  772. - -----------------------------------------------------------------------
  773. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  774.                              |          Sound Manager Expert
  775. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  776. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  777. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  778.  
  779. +++++++++++++++++++++++++++
  780.  
  781. From: yjc@po.cwru.edu (Jerome Chan)
  782. Date: 11 Jul 92 06:35:40 GMT
  783. Organization: Alethea, The Twilight World!
  784.  
  785. In article <69761@apple.Apple.COM> Charle Reiman, creiman@Apple.COM
  786. writes:
  787. >If you're running Think C, you can probably get to the Gestalt glue by
  788. [... Other Stuff Deleted ...]
  789.  
  790.   Where is this Gestalt Glue documented for Think C? You mean I spent the
  791. entire night digging through Inside Mac V and VI,trying to code for
  792. Gestalt and SysEnvirons for nothing? :)
  793.  
  794.   Eagerly awaiting replies.
  795.  
  796.  
  797. - -Beware! NewBie Programmer at work-
  798.  
  799. +++++++++++++++++++++++++++
  800.  
  801. From: jsp@uts.amdahl.com (James Preston)
  802. Date: 15 Jul 92 00:41:18 GMT
  803. Organization: Amdahl Corporation, Sunnyvale CA
  804.  
  805. yjc@po.cwru.edu (Jerome Chan) writes:
  806.  
  807. }In article <69761@apple.Apple.COM> Charle Reiman, creiman@Apple.COM
  808. }writes:
  809. }>If you're running Think C, you can probably get to the Gestalt glue by
  810. }[... Other Stuff Deleted ...]
  811.  
  812. }  Where is this Gestalt Glue documented for Think C? You mean I spent the
  813. }entire night digging through Inside Mac V and VI,trying to code for
  814. }Gestalt and SysEnvirons for nothing? :)
  815.  
  816. Yup.  Just like I, apparently, typed in all the does-this-trap-exist code
  817. from IM VI for nothing.
  818.  
  819. The glue is not documented anywhere in the THINK C documentation.  Symantec
  820. makes great compilers, but the completeness of their documentation is sadly
  821. lacking.
  822.  
  823. - --James Preston
  824.  
  825.  
  826. +++++++++++++++++++++++++++
  827.  
  828. From: siegel@world.std.com (Rich Siegel)
  829. Organization: GCC Technologies
  830. Date: Wed, 15 Jul 1992 01:01:07 GMT
  831.  
  832. In article <5cWy03MV36Pd00@amdahl.uts.amdahl.com> jsp@pls.amdahl.com writes:
  833.  
  834. >The glue is not documented anywhere in the THINK C documentation.  Symantec
  835. >makes great compilers, but the completeness of their documentation is sadly
  836. >lacking.
  837.  
  838. In defense of the guys who wrote the doc, it's not their responsibility (nor
  839. is it Symantec's) to document the Macintosh toolbox interface, particularly
  840. since it's a moving target. The Gestalt glue (and the rest of the components
  841. of MacTraps and MacTraps2) are supplied by Apple.
  842.  
  843. It's also not their responsibility to teach people how to program the Macintosh
  844. or how to program in C; there are reference materials already extant that
  845. do a very complete job at both tasks, including, but not limited to,
  846. Kernighan & Ritchie's "The C Programming Language" and Apple Computer's
  847. "Inside Macintosh" (along with associated technical notes and other related
  848. materials).
  849.  
  850. R.
  851.  
  852.  
  853.  
  854. - -- 
  855. - -----------------------------------------------------------------------
  856. Rich Siegel                              Internet: siegel@world.std.com
  857. Software Engineer & Toolsmith
  858. GCC Technologies
  859.  
  860. +++++++++++++++++++++++++++
  861.  
  862. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  863. Organization: NASA/ARC Information Sciences Division
  864. Date: Thu, 16 Jul 1992 01:57:01 GMT
  865.  
  866. No, I agree, the think C manuals, while very good, could use to be
  867. a little better, especially in the area of cross - referencing.
  868.  
  869. - -- 
  870. - ----------------------------------
  871. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  872. joshr@kronos.arc.nasa.gov
  873. "Why is it that we drive on parkways and park in driveways?" - self
  874.  
  875. +++++++++++++++++++++++++++
  876.  
  877. From: jsp@uts.amdahl.com (James Preston)
  878. Date: 20 Jul 92 20:43:57 GMT
  879. Organization: Amdahl Corporation, Sunnyvale CA
  880.  
  881. siegel@world.std.com (Rich Siegel) writes:
  882.  
  883. }In article <5cWy03MV36Pd00@amdahl.uts.amdahl.com> jsp@pls.amdahl.com writes:
  884.  
  885. }>The glue is not documented anywhere in the THINK C documentation.  Symantec
  886. }>makes great compilers, but the completeness of their documentation is sadly
  887. }>lacking.
  888.  
  889. }In defense of the guys who wrote the doc, it's not their responsibility (nor
  890. }is it Symantec's) to document the Macintosh toolbox interface, particularly
  891. }since it's a moving target. The Gestalt glue (and the rest of the components
  892. }of MacTraps and MacTraps2) are supplied by Apple.
  893.  
  894. }It's also not their responsibility to teach people how to program the Macintosh
  895. }or how to program in C; there are reference materials already extant that
  896. }do a very complete job at both tasks, including, but not limited to,
  897. }Kernighan & Ritchie's "The C Programming Language" and Apple Computer's
  898. }"Inside Macintosh" (along with associated technical notes and other related
  899. }materials).
  900.  
  901. Well, this is getting a little off topic, but since I feel strongly that
  902. the THINK products' documentation is a very large blemish on otherwise
  903. excellent products, I'd like to followup a little.
  904.  
  905. I disagree when you say that it is not the responsibility of the THINK C
  906. documentation to talk about something like the Gestalt glue code.  In the
  907. first place (and I'm sure I don't need to remind Rich of this), THINK C
  908. is not just a C compiler, it is a Macintosh development environment.
  909. Therefore, its documentation certainly should talk about the interface
  910. between the application program and the Mac toolbox.  More importantly,
  911. in this particular case, calling the glue code is something that the compiler
  912. does _behind the programmer's back_.  It doesn't matter where that glue
  913. code comes from, be it Apple or anywhere else; the point is that the code
  914. generator does not see my call to Gestalt and emit a call to directly to
  915. Gestalt.  It emits code to call the glue code.  I agree that it is a good
  916. thing to do, but certainly any such behind the back calling must be
  917. documented by the product that does so, which in this case is THINK C.
  918.  
  919. I don't see how something like this can be put in the category of "teaching"
  920. Mac or C programming; what I'm saying is that the documentation left out
  921. a feature _of the code generator_ (i.e. that it calls glue code rather than
  922. the Gestalt routine directly), and I therefore ended up doing an hour or
  923. so of unecessary work.
  924.  
  925. - --James Preston
  926.  
  927.  
  928. +++++++++++++++++++++++++++
  929.  
  930. From: Chewy@cup.portal.com (Paul Frederick Snively)
  931. Date: Mon, 20 Jul 92 21:53:28 PDT
  932. Organization: The Portal System (TM)
  933.  
  934.  
  935. +++++++++++++++++++++++++++
  936.  
  937. From: Chewy@cup.portal.com (Paul Frederick Snively)
  938. Date: Mon, 20 Jul 92 21:56:46 PDT
  939. Organization: The Portal System (TM)
  940.  
  941. jsp@uts.amdahl.com (James Preston) writes:
  942.  
  943. >siegel@world.std.com (Rich Siegel) writes:
  944. >
  945. >}In article <5cWy03MV36Pd00@amdahl.uts.amdahl.com> jsp@pls.amdahl.com writes:
  946. >
  947. >}>The glue is not documented anywhere in the THINK C documentation.  Symantec
  948. >}>makes great compilers, but the completeness of their documentation is sadly
  949. >}>lacking.
  950. >
  951. >}In defense of the guys who wrote the doc, it's not their responsibility (nor
  952. >}is it Symantec's) to document the Macintosh toolbox interface, particularly
  953. >}since it's a moving target. The Gestalt glue (and the rest of the components
  954. >}of MacTraps and MacTraps2) are supplied by Apple.
  955. >
  956. >}It's also not their responsibility to teach people how to program the Macinto
  957. sh
  958. >}or how to program in C; there are reference materials already extant that
  959. >}do a very complete job at both tasks, including, but not limited to,
  960. >}Kernighan & Ritchie's "The C Programming Language" and Apple Computer's
  961. >}"Inside Macintosh" (along with associated technical notes and other related
  962. >}materials).
  963. >
  964. >Well, this is getting a little off topic, but since I feel strongly that
  965. >the THINK products' documentation is a very large blemish on otherwise
  966. >excellent products, I'd like to followup a little.
  967. >
  968. >I disagree when you say that it is not the responsibility of the THINK C
  969. >documentation to talk about something like the Gestalt glue code.  In the
  970. >first place (and I'm sure I don't need to remind Rich of this), THINK C
  971. >is not just a C compiler, it is a Macintosh development environment.
  972. >Therefore, its documentation certainly should talk about the interface
  973. >between the application program and the Mac toolbox.
  974.  
  975. The THINK C documentation _does_ talk about the interface between the
  976. application program and the Mac toolbox, to the extent that it documents
  977. how to use #include files and libraries in your projects.  There is nothing
  978. magical about the Toolbox/OS interface viz-a-viz interfacing to any other
  979. kind of library that you have library/header files for.
  980.  
  981. >More importantly,
  982. >in this particular case, calling the glue code is something that the compiler
  983. >does _behind the programmer's back_.  It doesn't matter where that glue
  984. >code comes from, be it Apple or anywhere else; the point is that the code
  985. >generator does not see my call to Gestalt and emit a call to directly to
  986. >Gestalt.  It emits code to call the glue code.  I agree that it is a good
  987. >thing to do, but certainly any such behind the back calling must be
  988. >documented by the product that does so, which in this case is THINK C.
  989.  
  990. I have to disagree.  As has been pointed out before, the interfaces and
  991. libraries that the THINK products ship with are licensed from Apple and
  992. are a moving target.  Not only is Symantec not under the obligation to
  993. reiterate Apple documentation regarding Apple interfaces and libraries,
  994. it would be, IMHO, irresponsible of them to do so, since maintaining
  995. parallel versions of such documentation would be a herculean effort
  996. replete with the potential for the most egregious sorts of errors to
  997. occur.
  998.  
  999. >I don't see how something like this can be put in the category of "teaching"
  1000. >Mac or C programming; what I'm saying is that the documentation left out
  1001. >a feature _of the code generator_ (i.e. that it calls glue code rather than
  1002. >the Gestalt routine directly), and I therefore ended up doing an hour or
  1003. >so of unecessary work.
  1004.  
  1005. Your assertion that the inclusion of the Gestalt glue in your code is `a
  1006. feature _of the code generator_' is in error.  The Gestalt call is defined
  1007. in ":Mac #includes:Apple #includes:GestaltEqu.h" (from the THINK C folder)
  1008. and is conditionalized on whether the compiler variable SystemSevenOrLater is
  1009. defined or not.  If it is defined, then the trap is used, otherwise the
  1010. function declaration is left unresolved, in which case it's up to the linker
  1011. to cope with it.  Note that all of these machinations--#include files,
  1012. compiler variables, preprocessor directives, etc.--are documented in the
  1013. THINK C documentation.  Apple's particular use of these features in their
  1014. interfaces and libraries, however, are not, and this is what I claim is as
  1015. it should be.
  1016.  
  1017. >--James Preston
  1018.  
  1019. Paul Snively
  1020. Dissolute Wandering Hacker
  1021. chewy@apple.com
  1022.  
  1023. +++++++++++++++++++++++++++
  1024.  
  1025. From: keith@taligent.com (Keith Rollin)
  1026. Date: 21 Jul 92 17:40:05 GMT
  1027. Organization: Taligent
  1028.  
  1029. In article <c6n403hY3dcZ00@amdahl.uts.amdahl.com>, jsp@uts.amdahl.com (James
  1030. Preston) writes:
  1031. > I disagree when you say that it is not the responsibility of the THINK C
  1032. > documentation to talk about something like the Gestalt glue code.  In the
  1033. > first place (and I'm sure I don't need to remind Rich of this), THINK C
  1034. > is not just a C compiler, it is a Macintosh development environment.
  1035. > Therefore, its documentation certainly should talk about the interface
  1036. > between the application program and the Mac toolbox.  More importantly,
  1037. > in this particular case, calling the glue code is something that the compiler
  1038. > does _behind the programmer's back._  It doesn't matter where that glue
  1039. > code comes from, be it Apple or anywhere else; the point is that the code
  1040. > generator does not see my call to Gestalt and emit a call to directly to
  1041. > Gestalt.  It emits code to call the glue code.  I agree that it is a good
  1042. > thing to do, but certainly any such behind the back calling must be
  1043. > documented by the product that does so, which in this case is THINK C.
  1044.  
  1045. I must agree with Paul in disagreeing with you here. First of all, this is
  1046. nothing new, and you never complained until now. There are many, many routines
  1047. that are glue routines that appear no differently that direct trap calls. Take a
  1048. look at Inside Mac. Any routine marked as Not In ROM is a glue routine.
  1049. Additionally, until MPW 3.1, almost every OS routine was also a glue routine in
  1050. order to convert from a register based convention into a stack based based
  1051. calling convention. (This has been now changed with the use of inline code and
  1052. #pragma parameter). Finally, there are several calls provided as glue for C
  1053. programmers that convert C strings into Pascal strings before calling the
  1054. ToolBox or OS.
  1055.  
  1056. Secondly, calling the Gestalt glue is definitely not an idiosyncracy of the code
  1057. generator. If anything, you've got it the wrong way around. In C, something with
  1058. the following form:
  1059.  
  1060.         myErr = Gestalt(selector, &result);
  1061.  
  1062. is a function call (or a macro, I suppose), and results in the compiler calling
  1063. a function linked with your application. Anything else, such as inserting a trap
  1064. number, is the exceptional case. The code generator is just doing what the
  1065. headers tell it to, and in the normal case, the headers tell the compiler to
  1066. generate a function call.
  1067.  
  1068. - --
  1069. Keith Rollin
  1070. Phantom Programmer
  1071. Taligent, Inc.
  1072.  
  1073.  
  1074. ---------------------------
  1075.  
  1076. End of C.S.M.P. Digest
  1077. **********************
  1078.